Skip to content

Add option to return index in linear search#1563

Open
darshan2456 wants to merge 1 commit intoTheAlgorithms:masterfrom
darshan2456:linear_search_return_idx
Open

Add option to return index in linear search#1563
darshan2456 wants to merge 1 commit intoTheAlgorithms:masterfrom
darshan2456:linear_search_return_idx

Conversation

@darshan2456
Copy link

Resolves #1544

I changed the linear_search() to return index and -1 if element is not found. I am taking user input as to if they want to see the index and as per user input, i have branched the execution flow with a simple if statement.

  • Added description of change
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OTHER] Linear search not returning index

1 participant